package com.stefanini.pe.bbva.bp.in.bo.datasource;

import java.util.ArrayList;
import java.util.List;

import com.stefanini.pe.bbva.bp.in.to.Ejecutivo;

import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRField;

public class ListarEjecutivosDS implements JRDataSource{
	
	private List listEjec = new ArrayList();
    private int indexEjec= -1;
    
    public ListarEjecutivosDS(List listEjec) {
    	this.listEjec = listEjec;
    }
    
    public boolean next() throws JRException {
    	indexEjec++;
        return (indexEjec < listEjec.size());
    }
    
    public Object getFieldValue(JRField field) throws JRException {
        Object value = null;
        String fieldName = field.getName();
        Ejecutivo object = (Ejecutivo)listEjec.get(indexEjec);
        if ("F_CODIGO".equals(fieldName)) {
            value = object.getCodigo();
        } else if ("F_DESCRIPCION".equals(fieldName)) {
            value = object.getDescripcion();
        } 
        return value;
    }

	public int getIndexEjec() {
		return indexEjec;
	}

	public void setIndexEjec(int indexEjec) {
		this.indexEjec = indexEjec;
	}

	public List getListEjec() {
		return listEjec;
	}

	public void setListEjec(List listEjec) {
		this.listEjec = listEjec;
	}
}
